package com.Maykk.Demo12;

/**
 * @ClassName: MyStringBuilder
 * @Description: TODO MyStringBuilder 字符串操作类
 * @Author: MaykkStar@163.com
 */
public class MyStringBuilder {
    private String str = "";

    /**
     * 拼接字符串
     *
     * @param str 要拼接进来的字符串
     * @return 当前类
     */
    public MyStringBuilder append(String str) {
        this.str += str + " ";
        return this;
    }

    /**
     * 输出字符串，并把字符串设置为空字符串
     */
    public void printInfo() {
        System.out.println(this.str);
        this.str = "";
    }

    public String getStr() {
        return this.str;
    }

    @Override
    public String toString() {
        return "MyStringBuilder{" +
                "str='" + str + '\'' +
                '}';
    }
}
